web/src/pages/[...listing].astro
699 lines · 19598 bytes
1---
2
3import Layout from '@layouts/Layout.astro';
4import ServiceList from '@components/things/ServiceList.astro';
5import Comments from '@components/things/Comments.svelte';
6import GitHubDetailedInfo from '@components/things/GitHubDetailedInfo.astro';
7import PrivacyPolicyDetails from '@components/things/PrivacyPolicyDetails.astro';
8import WebsiteDetailedInfo from '@components/things/WebsiteDetailedInfo.astro';
9import DockerDetailedInfo from '@components/things/DockerDetailedInfo.astro';
10import IosAppDetailedInfo from '@components/things/IosAppDetailedInfo.astro';
11import AndroidAppDetailedInfo from '@components/things/AndroidDetailedInfo.astro';
12import DiscordDetailedInfo from '@components/things/DiscordDetailedInfo.astro';
13import RedditDetailedInfo from '@components/things/RedditDetailedInfo.astro';
14import SocialShare from '@components/form/Social.astro';
15import DataActions from '@components/things/DataActions.svelte';
16import type { AwesomePrivacy, Section, Service } from '../types/Service';
17import { fetchData, slugify } from '@utils/fetch-data';
18import { fetchGitHubStats } from '@utils/fetch-repo-info';
19import { fetchTosdrPrivacy } from '@utils/fetch-privacy-policy';
20import { fetchWebsiteInfo } from '@utils/fetch-website-info';
21import { fetchDockerData } from '@utils/fetch-docker-instructions';
22import { fetchIosInfo } from '@utils/fetch-ios-info';
23import { fetchAndroidInfo } from '@utils/fetch-android-info';
24import { fetchDiscordInfo } from '@utils/fetch-discord-info';
25import { fetchRedditInfo } from '@utils/fetch-reddit-info';
26import { parseMarkdown, formatLink } from '@utils/parse-markdown';
27import { site } from '@utils/config';
28import FontAwesome from '@components/form/FontAwesome.svelte';
29import Button from '@components/form/Button.astro';
30import SaveListing from '@components/things/SaveListing.svelte';
31
32interface Props extends Service {
33 slug: string;
34 parentSection: Section;
35 categoryName: string;
36}
37
38const {
39 name,
40 description,
41 url,
42 github,
43 tosdrId,
44 discordInvite,
45 subreddit,
46 iosApp,
47 androidApp,
48 icon,
49 followWith,
50 securityAudited,
51 openSource,
52 acceptsCrypto,
53 parentSection,
54 categoryName,
55} = Astro.props;
56
57
58/**
59 * Make a list of keywords, for the <meta keywords> tag
60 */
61const makeKeyWordTag = () => {
62 const keywords: string[] = [];
63 keywords.push(`open source ${parentSection.name}`);
64 keywords.push(`${parentSection.name} comparison`);
65 (parentSection.alternativeTo || []).forEach((alt: string) => {
66 keywords.push(`${alt} alternative`);
67 });
68 (parentSection.services || []).forEach((serv: Service) => {
69 keywords.push(`${serv.name} vs`);
70 });
71 keywords.push('private');
72 keywords.push('ad free');
73 keywords.push('encrypted');
74 keywords.push('open source software');
75 keywords.push('privacy respecting apps');
76 keywords.push('free tools');
77 return keywords.join(', ');
78};
79
80/**
81 * Make a page title
82 */
83const makePageTitle = () => {
84 return `${name} | ${parentSection.name} | ${categoryName} | Awesome Privacy`;
85};
86
87/**
88 * Make a string page intro, for the description tag
89 */
90const makeDescriptionTag = () => {
91 let description = `Analysis of ${name}, and other privacy-respecting ${parentSection.name} `;
92 if (parentSection.services) {
93 const serviceList = parentSection.services.map((serv: Service) => serv.name);
94 description += `Compare ${serviceList.join(' vs ')} more apps. `
95 }
96 if (parentSection.alternativeTo && parentSection.alternativeTo.length > 0) {
97 description += `The best secure encrypted alternatives to ${parentSection.alternativeTo.join(', ')} in 2024. `;
98 }
99 description += 'All this, and many more free and awesome tools and software.'
100 return description;
101};
102
103// Return a list of Services, except for the currtent one
104const filterServices = () => {
105 return parentSection.services.filter((service: Service) => service.name !== name);
106};
107
108export async function getStaticPaths() {
109 const pages = await fetchData().then((data) => {
110 const results: Array<Props> = [];
111 if (!data || !data.categories) return results;
112 (data as AwesomePrivacy).categories.forEach((category) => {
113 category.sections.forEach((section) => {
114 const services = (section.services || []).map((service) => {
115 return {
116 slug: `${slugify(category.name)}/${slugify(section.name)}/${slugify(service.name)}`,
117 parentSection: section,
118 categoryName: category.name,
119 ...service,
120 };
121 });
122 results.push(...services);
123 });
124
125 });
126 return results;
127 });
128
129 return pages.map((props: Props) => {
130 return {params: { listing: props.slug }, props };
131 });
132}
133
134const makePaginationLinks = () => {
135 const allServices = parentSection.services || [];
136 const index = allServices.findIndex(item => item.name === name);
137 const previousItem = index > 0 ? allServices[index - 1].name : null;
138 const nextItem = index < allServices.length - 1 ? allServices[index + 1].name : null;
139 return { previous: previousItem, next: nextItem };
140};
141
142const { previous, next } = makePaginationLinks();
143
144const ignoredSites = ['github.gom', 'wikipedia.'];
145
146// Fetch detailed data about the services GitHub repo, privacy policy and website
147const githubData = github ? await fetchGitHubStats(github) : null;
148const privacyData = tosdrId ? await fetchTosdrPrivacy(tosdrId) : null;
149const iosData = iosApp ? await fetchIosInfo(iosApp) : null;
150const androidData = androidApp ? await fetchAndroidInfo(androidApp) : null;
151const discordData = discordInvite ? await fetchDiscordInfo(discordInvite) : null;
152const redditData = subreddit ? await fetchRedditInfo(subreddit) : null;
153const dockerData = await fetchDockerData(name);
154const websiteData = (url && !ignoredSites.some(ignoredSite => url.includes(ignoredSite))) ? await fetchWebsiteInfo(url) : null;
155
156const findPrivacyPolicyLink = () => {
157 if (!privacyData) return null;
158 const docs = privacyData.parameters.documents;
159 if (docs) {
160 const privacyPolicy = (docs || []).find((doc) => doc.name.toLowerCase().includes('privacy policy'));
161 if (privacyPolicy) return privacyPolicy.url;
162 }
163 return `https://tosdr.org/en/service/${tosdrId}`;
164};
165
166const privacyPolicyLink = findPrivacyPolicyLink();
167
168const getApiEndpoint = () => {
169 return `https://api.awesome-privacy.xyz/${slugify(categoryName)}/${slugify(parentSection.name)}/${slugify(name)}`;
170}
171
172---
173
174<Layout title={makePageTitle()} keywords={makeKeyWordTag()} description={makeDescriptionTag()} >
175 <main>
176 <section>
177 <div class="service-head">
178 <h2>{name}</h2>
179 <span class="url-wrap">
180 <a class="service-url" href={url}>{formatLink(url)}</a>
181 <span class="follow-with">{followWith}</span>
182 </span>
183 </div>
184 <div class="breadcrumbs">
185 <span>
186 <a href="/">Awesome Privacy</a>
187 ➔ <a href={`/${slugify(categoryName)}`}>{categoryName}</a>
188 ➔ <a href={`/${slugify(categoryName)}/${slugify(parentSection.name)}`}>{parentSection.name}</a>
189 ➔ <a href={`/${slugify(categoryName)}/${slugify(parentSection.name)}/${slugify(name)}`}>{name}</a>
190 </span>
191 </div>
192 <div class="save-listing">
193 <SaveListing client:visible
194 categoryName={categoryName}
195 sectionName={parentSection.name}
196 serviceName={name}
197 showLabel={true}
198 />
199 </div>
200 <div class="intro">
201 <img
202 width="60"
203 height="60"
204 loading="lazy"
205 decoding="async"
206 class="service-icon"
207 alt={`${name} Icon`}
208 data-service-url={formatLink(url)}
209 src={icon || `https://icon.horse/icon/${formatLink(url)}`}
210 />
211 <div>
212 <p class="description" set:html={parseMarkdown(description)}></p>
213 <ul>
214 { url && (
215 <li>
216 <b>Homepage:</b>
217 <a href={url}>{formatLink(url)}</a>
218 </li>
219 )}
220 { github && (
221 <li>
222 <b>GitHub:</b>
223 <a href={`https://github.com/${github}`}>github.com/{github}</a>
224 </li>
225 )}
226 { tosdrId && (
227 <li>
228 <b>Privacy:</b>
229 <a href={privacyPolicyLink}>{formatLink(privacyPolicyLink || '')}</a>
230 </li>
231 )}
232 { iosApp && (
233 <li>
234 <b>iOS App:</b>
235 <a href={iosApp}>{formatLink(iosApp)}</a>
236 </li>
237 )}
238 { androidApp && (
239 <li>
240 <b>Android App:</b>
241 <a href={`https://play.google.com/store/apps/details?id=${androidApp}`}>{`https://play.google.com/store/apps/details?id=${androidApp}`}</a>
242 </li>
243 )}
244 { discordInvite && (
245 <li>
246 <b>Discord Invite:</b>
247 <a href={`https://discord.com/invite/${discordInvite}`}>{discordInvite}</a>
248 </li>
249 )}
250 { subreddit && (
251 <li>
252 <b>Subreddit:</b>
253 <a href={`https://reddit.com/r/${subreddit}`}>r/{subreddit}</a>
254 </li>
255 )}
256 { url && (
257 <li>
258 <b>Web info:</b>
259 <a href={`https://web-check.xyz/results/${formatLink(url)}`}>{`web-check.xyz/results/${formatLink(url).split('/')[0]}`}</a>
260 </li>
261 )}
262 </ul>
263 </div>
264 </div>
265 <div class="highlights">
266 { securityAudited && (
267 <span class="meta-item great" title={`${name} has been security audited by an accredited auditor, with results published publicly`}>
268 <FontAwesome iconName="securityAudited" /> Security Audited
269 </span>
270 )}
271 { acceptsCrypto && (
272 <span class="meta-item great" title={`${name} accepts anonymous payment methods`}>
273 <FontAwesome iconName="cryptoAccepted" /> Crypto Payments Accepted
274 </span>
275 )}
276 { securityAudited === false && (
277 <span class="meta-item warning" title={`${name} has not been audited`}>
278 <FontAwesome iconName="notSecurityAudited" /> No Security Audit
279 </span>
280 )}
281 { (openSource === false) && (
282 <span class="warning">
283 <FontAwesome iconName="closedSource" />
284 Not Open Source
285 </span>
286 )}
287 { openSource || (github && openSource !== false) ? (
288 <span class="meta-item great" title={`${name} is open source`}>
289 <FontAwesome iconName="openSource" /> Open Source
290 </span>
291 ) : null }
292 </div>
293 </section>
294 { privacyData && privacyData.parameters.points.length > 0 && (
295 <section>
296 <h3>{name} Privacy Policy</h3>
297 <PrivacyPolicyDetails privacyData={privacyData} />
298 </section>
299 )}
300 { github && githubData && (
301 <section class="github-wrap">
302 <h3>{name} Source Code</h3>
303 <GitHubDetailedInfo gitHubData={githubData} repo={github} />
304 </section>
305 )}
306 { websiteData && (
307 <section>
308 <h3>{name} Website</h3>
309 <WebsiteDetailedInfo url={url} websiteInfo={websiteData} />
310 </section>
311 )}
312 { androidData && (
313 <section>
314 <h3>{name} Android App</h3>
315 <AndroidAppDetailedInfo androidData={androidData} />
316 </section>
317 )}
318 { iosData && (
319 <section>
320 <h3>{name} iOS App</h3>
321 <IosAppDetailedInfo url={url} iosData={iosData} />
322 </section>
323 )}
324 { dockerData && dockerData.found && (
325 <section>
326 <h3>{name} Docker</h3>
327 <DockerDetailedInfo docker={dockerData} />
328 </section>
329 )}
330 { (discordData || redditData) && (
331 <section>
332 <h3>{name} Socials</h3>
333 <div class="social-wrap">
334 { discordData && <DiscordDetailedInfo discordData={discordData} /> }
335 { redditData && <RedditDetailedInfo redditData={redditData} /> }
336 </div>
337 </section>
338 )}
339
340 <section>
341 <h3>{name} Reviews</h3>
342 <Comments client:visible />
343 </section>
344
345 <section>
346 <h3>More {parentSection.name}</h3>
347 <ServiceList
348 services={filterServices()}
349 subHeading={true}
350 noGitHubMetrics={true}
351 buttonLink={`/${slugify(categoryName)}/${slugify(parentSection.name)}`}
352 categoryName={categoryName}
353 sectionName={parentSection.name}
354 />
355 </section>
356 <section>
357 <h3>About the Data: {name}</h3>
358 <DataActions client:load categoryName={categoryName} sectionName={parentSection.name} serviceName={name} />
359 <h4>API</h4>
360 <p>
361 You can access {name}'s data programmatically via our API.
362 Simply make a <code>GET</code> request to:
363 </p>
364 <pre><a href={getApiEndpoint()}><code>{getApiEndpoint()}</code></a></pre>
365 <p>
366 The REST API is free, no-auth and CORS-enabled.
367 To learn more, view the <a href="/api">Swagger Docs</a> or read the <a href="/about#api">API Usage Guide</a>.
368 </p>
369
370 <h4>About the Data</h4>
371 <p>
372 Beyond the user-submitted YAML you see above, we also augment each listing with
373 additional data dynamically fetched from several sources.
374 To learn more about where the rest of data included in this page comes from,
375 and how it is computed,
376 see the <a href="/about#our-data">About the Data</a> section of our About page.
377 </p>
378 </section>
379
380 <section>
381 <h3>Share {name}</h3>
382 <p>
383 Help your friends compare {parentSection.name}, and pick privacy-respecting software and services.<br />
384 Share {name} and Awesome Privacy with your network!
385 <div>
386 <SocialShare
387 url={`${site}/${slugify(categoryName)}/${slugify(parentSection.name)}/${slugify(name)} `}
388 title={`Checkout ${name}! \n`}
389 description={
390 `Compare #${name} and other privacy-respecting ${parentSection.name} at `
391 + `Awesome-Privacy.xyz, the free and open source list of private software alternatives. `
392 + `#privacy #opensource #awesomeprivacy by @Lissy_Sykes`}
393 />
394 </div>
395 </p>
396 </section>
397
398 <div class="pagination-navigation">
399 { previous ? (
400 <Button url={`/${slugify(categoryName)}/${slugify(parentSection.name)}/${slugify(previous)}`}>
401 <span>← Previous</span>
402 <p>{previous}</p>
403 </Button>
404 ) : <p class="nothing"></p>}
405 <a href={`/${slugify(categoryName)}/${slugify(parentSection.name)}`} class="go-to-category">
406 View {parentSection.name} ({(parentSection.services || []).length})
407 </a>
408 { next && (
409 <Button url={`/${slugify(categoryName)}/${slugify(parentSection.name)}/${slugify(next)}`}>
410 <span>Next →</span>
411 <p>{next}</p>
412 </Button>
413 )}
414 </div>
415 </main>
416</Layout>
417
418<style lang="scss">
419
420main {
421 margin: 2rem auto;
422 padding: 1rem;
423 width: 1000px;
424 max-width: calc(100% - 5rem);
425 position: relative;
426 @media(max-width: 768px) {
427 max-width: 95%;
428 padding: 0.5rem;
429 margin: 0 auto;
430 }
431}
432
433section {
434 margin: 1rem 0 4rem 0;
435 padding: 1rem;
436 min-height: 8rem;
437 position: relative;
438 border: 2px solid var(--box-outline);
439 box-shadow: 6px 6px 0 var(--box-outline);
440 background: var(--accent-fg);
441
442}
443
444p {
445 margin: 0.25rem 0 0.5rem 0;
446}
447
448h3 {
449 font-size: 2rem;
450 margin: -2rem 0 1rem -2rem;
451 box-shadow: 6px 6px 0 var(--box-outline);
452 background: var(--accent);
453 color: var(--accent-fg);
454 width: fit-content;
455 padding: 0.25rem 0.5rem;
456 @media(max-width: 768px) {
457 margin: -2rem auto 2rem auto;
458 }
459 }
460
461.service-head {
462 h2 {
463 font-size: 3rem;
464 margin: 0;
465 @media(max-width: 768px) {
466 text-align: center;
467 }
468 }
469 .url-wrap {
470 display: flex;
471 align-items: center;
472 gap: 0.5rem;
473 a {
474 font-size: 1.2rem;
475 }
476 .follow-with {
477 font-style: italic;
478 opacity: 0.6;
479 }
480 @media(max-width: 768px) {
481 flex-direction: column;
482 }
483 }
484
485}
486
487.breadcrumbs {
488 opacity: 0.5;
489 font-size: 0.8rem;
490 position: absolute;
491 right: 1rem;
492 top: 1rem;
493 a {
494 color: var(--foreground);
495 transition: all 0.15s ease-in-out;
496
497 &:hover {
498 color: var(--accent);
499 }
500 }
501 @media(max-width: 768px) {
502 display: none;
503 }
504}
505
506.save-listing {
507 position: absolute;
508 top: 3rem;
509 right: 1rem;
510}
511
512h4 {
513 font-size: 1.4rem;
514 margin-bottom: 0;
515}
516
517.intro {
518 font-size: 1.2rem;
519 font-style: italic;
520 opacity: 0.9;
521 display: flex;
522 gap: 0.5rem;
523 @media(max-width: 768px) {
524 flex-direction: column;
525 }
526 .service-icon {
527 border-radius: var(--curve-md);
528 margin-top: 1rem;
529 @media(max-width: 768px) {
530 margin: 1rem auto 0 auto;
531 }
532 }
533 ul {
534 padding-left: 1rem;
535 list-style: circle;
536 font-style: normal;
537 font-size: 1rem;
538 margin-top: 0;
539 b {
540 font-size: 1rem;
541 font-weight: 400;
542 min-width: 85px;
543 display: inline-block;
544 @media(max-width: 768px) {
545 width: auto;
546 display: block;
547 }
548 }
549 }
550}
551
552.pagination-navigation {
553 display: flex;
554 justify-content: space-between;
555 align-items: center;
556 padding: 1rem 0;
557 :global(.button) {
558 min-width: 120px;
559 width: fit-content;
560 padding: 0.25rem 1rem;
561 text-align: right;
562 &:first-child { text-align: left; }
563 p {
564 margin: 0;
565 font-weight: normal;
566 font-size: 1rem;
567 }
568 span {
569 font-size: 0.8rem;
570 }
571
572 }
573 .nothing {
574 width: 120px;
575 }
576 .go-to-category {
577 color: var(--foreground);
578 font-size: 0.8rem;
579 opacity: 0.5;
580 @media (max-width: 768px) {
581 display: none;
582 }
583 }
584}
585
586
587
588.further-info, .notable-mentions, .word-of-warning {
589 h3 {
590 font-size: 1.4rem;
591 margin: 1rem 0;
592 }
593 :global(p) {
594 font-size: 0.9rem;
595 opacity: 0.7;
596 :global(strong) {
597 font-weight: 500;
598 }
599 :global(a) {
600 color: var(--foreground);
601 transition: all 0.15s ease-in-out;
602 &:hover {
603 color: var(--accent);
604 }
605 }
606 }
607 :global(strong) {
608 font-weight: 500;
609 }
610 :global(h4) {
611 font-size: 1.2rem;
612 margin: 0.5rem 0 0 0;
613 }
614 :global(ul) {
615 list-style: circle;
616 padding-left: 1rem;
617 font-size: 0.9rem;
618 opacity: 0.7;
619 li {
620 margin-bottom: 0.25rem;
621 :global(p) {
622 display: inline;
623 }
624 }
625 }
626}
627
628pre {
629 a {
630 text-decoration: none;
631 color: var(--foreground);
632 code {
633 background: #acabb782;
634 padding: 0.2rem 0.4rem;
635 border-radius: var(--curve-sm);
636 font-family: Courier New;
637 font-size: 0.9rem;
638 @media(max-width: 768px) {
639 white-space: break-spaces;
640 }
641 }
642 }
643}
644
645.social-wrap {
646 display: flex;
647 gap: 1rem;
648 flex-wrap: wrap;
649 justify-content: space-between;
650}
651
652.highlights {
653 display: flex;
654 gap: 1rem;
655 flex-wrap: wrap;
656 align-items: center;
657 justify-content: end;
658
659 .meta-item, .warning {
660 display: flex;
661 align-items: center;
662 // justify-content: center;
663 gap: 0.25rem;
664 opacity: 0.6;
665 font-size: 0.9rem;
666 padding: 0.5rem 0;
667 :global(svg) {
668 color: var(--foreground);
669 width: 1.2rem;
670 height: 1.2rem;
671 }
672 a {
673 text-decoration: none;
674 color: var(--foreground);
675 display: flex;
676 gap: 0.25rem;
677 &:hover {
678 color: var(--accent-3);
679 :global(svg) {
680 color: var(--accent-3);
681 }
682 }
683 }
684 }
685 .warning {
686 color: var(--danger);
687 :global(svg) {
688 color: var(--danger);
689 }
690 }
691 .great {
692 color: #007930; // var(--success);
693 :global(svg) {
694 color: #007930; // var(--success);
695 }
696 }
697}
698
699</style>